function observe(obj){
  for(let key in obj){
    let internalValue = obj[key];
    let funcs = [];
    Object.defineProperty(obj,key,{
      get:function(){
        // 依赖收集，记录：是哪个函数在用我
        if (window.__fun&&!funcs.includes(window.__fun)) {
          funcs.push(window.__fun)
        }
        return internalValue;
      },
      set:function(val){
        // 派发更新，运行：执行用我的函数
        internalValue = val
        for (let i = 0; i < funcs.length; i++) {
            funcs[i]()
        }

      }
    })
  }
}

function response(fn){
  window.__fun = fn
  fn()
  window.__fun = null
}